package com.ydy.shoot;

public class Bullet extends FlyingObject {
    private int speed = 3; //走步步数


    /** 构造方法   x:子弹的x坐标   y:子弹的y坐标*/
    public Bullet(int x,int y){
        image = ShootGame.bullet; //图片
        this.x = x; //x坐标:与英雄机有关
        this.y = y; //y坐标:与英雄机有关
    }

    /** 重写step() */
    public void step(){
        y-=speed; //y减(向上)
    }


    /** 重写outOfBounds() */
    public boolean outOfBounds(){
        return this.y<=-this.height; //子弹的y<=负的子弹的高，即为越界
    }
}

